package cn.tedu.jewelry.mapper;

import cn.tedu.jewelry.entity.Order;
import cn.tedu.jewelry.vo.OrderStandVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//订单模块
@Mapper
public interface OrderMapper {

    //订单订单管理:获取所有订单
    @Result(column = "user_id",property = "userId")
    @Result(column = "contact_name",property = "contactName")
    @Result(column = "mobile_phone",property = "mobilePhone")
    @Result(column = "province_code",property = "provinceCode")
    @Result(column = "province_name",property = "provinceName")
    @Result(column = "city_code",property = "cityCode")
    @Result(column = "city_name",property = "cityName")
    @Result(column = "district_code",property = "districtCode")
    @Result(column = "district_name",property = "districtName")
    @Result(column = "street_code",property = "streetCode")
    @Result(column = "street_name",property = "streetName")
    @Result(column = "detailed_address",property = "detailedAddress")
    @Result(column = "payment_type",property = "paymentType")
    @Result(column = "reward_point",property = "rewardPoint")
    @Result(column = "amount_of_original_price",property = "amountOfOriginalPrice")
    @Result(column = "amount_of_freight",property = "amountOfFreight")
    @Result(column = "amount_of_discount",property = "amountOfDiscount")
    @Result(column = "amount_of_actual_pay",property = "amountOfActualPay")
    @Result(column = "gmt_order",property = "gmtOrder")
    @Result(column = "gmt_pay",property = "gmtPay")
    @Result(column = "gmt_create",property = "gmtCreate")
    @Result(column = "gmt_modified",property = "gmtModified")
    @Select("select * from user_order")
    List<OrderStandVO> getUserOrderList();

    //订单订单查询:按手机号查询
    @Result(column = "user_id",property = "userId")
    @Result(column = "contact_name",property = "contactName")
    @Result(column = "mobile_phone",property = "mobilePhone")
    @Result(column = "province_code",property = "provinceCode")
    @Result(column = "province_name",property = "provinceName")
    @Result(column = "city_code",property = "cityCode")
    @Result(column = "city_name",property = "cityName")
    @Result(column = "district_code",property = "districtCode")
    @Result(column = "district_name",property = "districtName")
    @Result(column = "street_code",property = "streetCode")
    @Result(column = "street_name",property = "streetName")
    @Result(column = "detailed_address",property = "detailedAddress")
    @Result(column = "payment_type",property = "paymentType")
    @Result(column = "reward_point",property = "rewardPoint")
    @Result(column = "amount_of_original_price",property = "amountOfOriginalPrice")
    @Result(column = "amount_of_freight",property = "amountOfFreight")
    @Result(column = "amount_of_discount",property = "amountOfDiscount")
    @Result(column = "amount_of_actual_pay",property = "amountOfActualPay")
    @Result(column = "gmt_order",property = "gmtOrder")
    @Result(column = "gmt_pay",property = "gmtPay")
    @Result(column = "gmt_create",property = "gmtCreate")
    @Result(column = "gmt_modified",property = "gmtModified")
    @Select("select * from user_order where mobile_phone=#{mobilePhone}")
    OrderStandVO getUserOrderByPhone(Long phone);

    //订单订单查询:按联系人查询
    @Result(column = "user_id",property = "userId")
    @Result(column = "contact_name",property = "contactName")
    @Result(column = "mobile_phone",property = "mobilePhone")
    @Result(column = "province_code",property = "provinceCode")
    @Result(column = "province_name",property = "provinceName")
    @Result(column = "city_code",property = "cityCode")
    @Result(column = "city_name",property = "cityName")
    @Result(column = "district_code",property = "districtCode")
    @Result(column = "district_name",property = "districtName")
    @Result(column = "street_code",property = "streetCode")
    @Result(column = "street_name",property = "streetName")
    @Result(column = "detailed_address",property = "detailedAddress")
    @Result(column = "payment_type",property = "paymentType")
    @Result(column = "reward_point",property = "rewardPoint")
    @Result(column = "amount_of_original_price",property = "amountOfOriginalPrice")
    @Result(column = "amount_of_freight",property = "amountOfFreight")
    @Result(column = "amount_of_discount",property = "amountOfDiscount")
    @Result(column = "amount_of_actual_pay",property = "amountOfActualPay")
    @Result(column = "gmt_order",property = "gmtOrder")
    @Result(column = "gmt_pay",property = "gmtPay")
    @Result(column = "gmt_create",property = "gmtCreate")
    @Result(column = "gmt_modified",property = "gmtModified")
    @Select("select * from user_order where contact_name=#{contactName}")
    OrderStandVO getOrderByUserName(String contactName);

    //订单订单查询:按订单订单号查询
    @Result(column = "user_id",property = "userId")
    @Result(column = "contact_name",property = "contactName")
    @Result(column = "mobile_phone",property = "mobilePhone")
    @Result(column = "province_code",property = "provinceCode")
    @Result(column = "province_name",property = "provinceName")
    @Result(column = "city_code",property = "cityCode")
    @Result(column = "city_name",property = "cityName")
    @Result(column = "district_code",property = "districtCode")
    @Result(column = "district_name",property = "districtName")
    @Result(column = "street_code",property = "streetCode")
    @Result(column = "street_name",property = "streetName")
    @Result(column = "detailed_address",property = "detailedAddress")
    @Result(column = "payment_type",property = "paymentType")
    @Result(column = "reward_point",property = "rewardPoint")
    @Result(column = "amount_of_original_price",property = "amountOfOriginalPrice")
    @Result(column = "amount_of_freight",property = "amountOfFreight")
    @Result(column = "amount_of_discount",property = "amountOfDiscount")
    @Result(column = "amount_of_actual_pay",property = "amountOfActualPay")
    @Result(column = "gmt_order",property = "gmtOrder")
    @Result(column = "gmt_pay",property = "gmtPay")
    @Result(column = "gmt_create",property = "gmtCreate")
    @Result(column = "gmt_modified",property = "gmtModified")
    @Select("select * from user_order where sn=#{orderNumber}")
    OrderStandVO getOrderByOrderNumber(String orderNumber);
}
